<style type="text/css">
    #triangle-right {
        margin-top: 5px;
        float: left;
        width: 0px;
        height: 0px;
        border-top: 5px solid transparent;
        border-left: 10px solid #269AC9;
        border-bottom: 5px solid transparent;
    }
</style>

<script type="text/javascript">
	//分页的异步请求重定向
	$("#memo_list_pages li a").click(function() {
			$("#tab1 ul li").remove();
	        $.ajax({ url: this.href, success: function(html) {
	             $("#myTabContent").empty().append(html);
	            }
	    });
	    	return false;
	    });
	 //异步排序
	 function sort_memos(sort_by){
		var memo_type = '<%=@memo_type%>';
		var osp_id = <%=@open_source_project.id%>;
		var sort_by = sort_by;
		$("#tab1 ul li").remove();
		ajax_url = '/show_memos_by_type?osp_id=' + osp_id + '&memo_type=' + memo_type + '&sort_by=' + sort_by;
		 $.ajax({ url: ajax_url, success: function(html) {
	            $("#myTabContent").empty().append(html);
	            }
	    });
	}
</script>
<!--我是分割线2===================================================================================================！-->
<div class="borad-topic-count" style="margin-top:10px">
<div>
  <h1 style="margin-top: 10px; margin-bottom: 0px; padding-bottom: 5px;">
      <span style="color: #269AC9;font-weight:900"><%= (@memo_type.eql? "news") ? "新闻资讯" : ((@memo_type.eql? "blog") ? "技术博客" : "技术讨论区") %>
      </span>
      <span style="font-size: 12px; padding-left: 5px;">共有 <a href="javascript:void(0)" style = "color: #E67E22;" onclick="show_all_memos('<%= @memo_type%>','nil')"><%=@topics_count%></a>
        条<%= (@memo_type.eql? "news") ? "新闻资讯" : ((@memo_type.eql? "blog") ? "技术博客" : "技术讨论帖") %>
      </span>
      <span style="font-size: 14px; float: right">
  	按&nbsp;
  	<% if "review_num DESC".eql?(@sort_by) %>
  	<a href="javascript:void(0)" onclick="sort_memos('created_time DESC')">时间</a>
  	&nbsp;&nbsp;/&nbsp;
  	<a href="javascript:void(0)" onclick="sort_memos('review_num ASC')">回帖 ↓</a>
  	&nbsp;&nbsp;/&nbsp;
  	<a href="javascript:void(0)" onclick="sort_memos('view_num DESC')">浏览</a>
  	
  	<% elsif "created_time DESC".eql?(@sort_by) %>
  	<a href="javascript:void(0)" onclick="sort_memos('created_time ASC')">时间 ↓</a>
  	&nbsp;&nbsp;/&nbsp;
  	<a href="javascript:void(0)" onclick="sort_memos('review_num DESC')">回帖 </a>
  	&nbsp;&nbsp;/&nbsp;
  	<a href="javascript:void(0)" onclick="sort_memos('view_num DESC')">浏览</a>
  	
  	<% elsif "view_num DESC".eql?(@sort_by) %>
  	<a href="javascript:void(0)" onclick="sort_memos('created_time DESC')">时间</a>
  	&nbsp;&nbsp;/&nbsp;
  	<a href="javascript:void(0)" onclick="sort_memos('review_num DESC')">回帖 </a>
  	&nbsp;&nbsp;/&nbsp;
  	<a href="javascript:void(0)" onclick="sort_memos('view_num ASC')">浏览 ↓</a>
  	
  	<% elsif "review_num ASC".eql?(@sort_by) %>
  	<a href="javascript:void(0)" onclick="sort_memos('created_time DESC')">时间</a>
  	&nbsp;&nbsp;/&nbsp;
  	<a href="javascript:void(0)" onclick="sort_memos('review_num DESC')">回帖 ↑ </a>
  	&nbsp;&nbsp;/&nbsp;
  	<a href="javascript:void(0)" onclick="sort_memos('view_num DESC')">浏览</a>
  	
  	<% elsif "created_time ASC".eql?(@sort_by) %>
  	<a href="javascript:void(0)" onclick="sort_memos('created_time DESC')">时间 ↑</a>
  	&nbsp;&nbsp;/&nbsp;
  	<a href="javascript:void(0)" onclick="sort_memos('review_num DESC')">回帖 </a>
  	&nbsp;&nbsp;/&nbsp;
  	<a href="javascript:void(0)" onclick="sort_memos('view_num DESC')">浏览</a>
  	
  	<% elsif "view_num ASC".eql?(@sort_by) %>
  	<a href="javascript:void(0)" onclick="sort_memos('created_time DESC')">时间</a>
  	&nbsp;&nbsp;/&nbsp;
  	<a href="javascript:void(0)" onclick="sort_memos('review_num DESC')">回帖 </a>
  	&nbsp;&nbsp;/&nbsp;
  	<a href="javascript:void(0)" onclick="sort_memos('view_num DESC')">浏览↑</a>
  	
  	<% else %>
  	<a href="javascript:void(0)" onclick="sort_memos('created_time DESC')">时间</a>
  	&nbsp;&nbsp;/&nbsp;
  	<a href="javascript:void(0)" onclick="sort_memos('review_num DESC')">回帖 </a>
  	&nbsp;&nbsp;/&nbsp;
  	<a href="javascript:void(0)" onclick="sort_memos('view_num DESC')">浏览</a>
  	<% end %>
  	
  	&nbsp;排序
  	
  </span>
  <div>
  	    	<hr style="margin-top: 5px; margin-bottom: 0px; width: 14%; height: 2px;background-color: #269AC9;float: left;">
  	    	<hr style="margin-top: 5px; margin-bottom: 0px; width: 85%; height: 1px;float: left;"> 
  	    </div>
    </h1>
</div>

</div>
<div class="memos_list" style="margin-left: 6px;">
  <% if @relative_memo_ids.any? %>
  <% for i in (0..@relative_memo_ids.length-1) %>
  	<% memo_id = @relative_memo_ids[i] %>
      <% memo = memo_id.topic %>
      <% next unless memo %>
      <li style="margin: 5px 0px 5px; height: 60px;">
        <div>
          <div id="triangle-right"></div>
          <div style="margin-left: 30px; float:left;">
            <%= link_to h(truncate(memo.title, :length => 30)), memo.url, :target => '_blank', :onclick => "return user_trace_click_knowledge_in_project_detail_after_click_more('#{@memo_type}','#{memo.id}','nil','#{@topics_pages.page}','#{i+1}','#{@sort_by}');" %>
            <div align="left" style="margin-top: 10px;">
                  <span class="font_lighter" style="margin-right: 30px;">来源:&nbsp<%= link_to memo.source, memo.url, :onclick => "return user_trace_click_knowledge_in_project_detail_after_click_more('#{@memo_type}','#{memo.id}','nil','#{@topics_pages.page}','#{i+1}','#{@sort_by}');" %></span>
                  <span class="font_lighter">
                    <%= user_url_and_time memo.author, memo.url, memo.created_time %>
                    <br/>
                  </span>
            </div>
          </div>
          <div style="float: right; width: 170px; margin-right: 20px;">
            <table width="170px" border="0">
              <tr>
                <td align="right" rowspan="2">
                  <table class="borad-count">
                    <tr>
                      <td align="center" class="borad-count-digit"><%= link_to (memo.review_num), memo.url, :target => '_blank', :onclick => "return user_trace_click_knowledge_in_project_detail_after_click_more('#{@memo_type}','#{memo.id}','nil','#{@topics_pages.page}','#{i+1}','#{@sort_by}');" %></td>
                    </tr>
                    <tr>
                      <td align="center">回帖</td>
                    </tr>
                  </table>
                </td>

                <!-- <td align="right" rowspan="3">
                  <table class="borad-count">
                    <tr>
                      <td align="center" class="borad-count-digit"><#%#= link_to (memo.collection_num), memo.url, :target => '_blank', :onclick => "return user_trace_click_knowledge_in_project_detail_after_click_more('#{@memo_type}','#{memo.id}','nil','#{@topics_pages.page}','#{i+1}','#{@sort_by}');" %></td>
                    </tr>
                    <tr>
                      <td align="center">关注</td>
                    </tr>
                  </table>
                </td> -->

                <td align="right" rowspan="2">
                  <table class="borad-count">
                    <tr>
                      <td align="center" class="borad-count-digit"><%= link_to (memo.view_num+memo.view_num_ossean), memo.url, :target => '_blank', :onclick => "return user_trace_click_knowledge_in_project_detail_after_click_more('#{@memo_type}','#{memo.id}','nil','#{@topics_pages.page}','#{i+1}','#{@sort_by}');" %></td>
                    </tr>
                    <tr>
                      <td align="center">浏览</td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </div>
        </div>
        <hr style="margin-top:15px; width: 99.5%;">
      </li>
  <% end %>
      <div id="memo_list_pages" class="pagination">
        <%= pagination_links_full @topics_pages, @relative_topics_count %>
      </div>
      <% else %>
      <p class="nodata">
        <%= l(:label_no_data) %>
      </p>
  <% end %>
</div>
<% if !(@memo_type.eql? "news")%>
<div class="borad-topic-count" style="margin-top:7px">
	<h1 style="margin-top: 10px; margin-bottom: 0px; padding-bottom: 5px;">
	<span style="color: #269AC9;font-weight:900"> 新闻资讯 
      </span>
      <span style="font-size: 12px; padding-left: 5px;">共有<a href="javascript:void(0)" style = "color: #E67E22;" onclick="show_all_memos('news','nil')"><%=@news_count%></a>
        条新闻资讯
      </span>
      <span style="font-weight:500;font-size:12px; float: right">
      	<a href="javascript:void(0)" style = "color:rgb(173,173,173);" onclick="show_all_memos('news','nil')">更多>></a>
  	    </span>
  	    <div>
  	    	<hr style="margin-top: 5px; margin-bottom: 0px; width: 14%; height: 2px;background-color: #269AC9;float: left;">
  	    	<hr style="margin-top: 5px; margin-bottom: 0px; width: 85%; height: 1px;float: left;"> 
  	    </div>
     </h1>
</div>
 <% end %>
<% if !(@memo_type.eql? "blog")%>
<div class="borad-topic-count" style="margin-top:7px">
	<h1 style="margin-top: 10px; margin-bottom: 0px; padding-bottom: 5px;">
	<span style="color: #269AC9;font-weight:900"> 技术博客
      </span>
      <span style="font-size: 12px; padding-left: 5px;">共有 <a href="javascript:void(0)" style = "color: #E67E22;" onclick="show_all_memos('blog','nil')"><%=@blogs_count%></a>
        条技术博客
      </span>
      <span style="font-weight:500;font-size:12px; float: right">
      	<a href="javascript:void(0)" style = "color:rgb(173,173,173);" onclick="show_all_memos('blog','nil')">更多>></a>
  	    </span>
  	    <div>
  	    	<hr style="margin-top: 5px; margin-bottom: 0px; width: 14%; height: 2px;background-color: #269AC9;float: left;">
  	    	<hr style="margin-top: 5px; margin-bottom: 0px; width: 85%; height: 1px;float: left;"> 
  	    </div>
     </h1>
</div>
 <% end %>
 <% if !(@memo_type.eql? "topic")%>
<div class="borad-topic-count" style="margin-top:7px">
	<h1 style="margin-top: 10px; margin-bottom: 0px; padding-bottom: 5px;">
	<span style="color: #269AC9;font-weight:900"> 技术讨论区 
      </span>
      <span style="font-size: 12px; padding-left: 5px;">共有 <a href="javascript:void(0)" style = "color: #E67E22;" onclick="show_all_memos('topic','nil')"><%=@posts_count%></a>
        条技术讨论帖 
      </span>
      <span style="font-weight:500;font-size:12px; float: right">
      	<a href="javascript:void(0)" style = "color:rgb(173,173,173);" onclick="show_all_memos('topic','nil')">更多>></a>
  	    </span>
  	    <div>
  	    	<hr style="margin-top: 5px; margin-bottom: 0px; width: 14%; height: 2px;background-color: #269AC9;float: left;">
  	    	<hr style="margin-top: 5px; margin-bottom: 0px; width: 85%; height: 1px;float: left;"> 
  	    </div>
     </h1>
</div>
 <% end %>
 
<!-- ajax user trace zhangxunhui begin -->
<script type="text/javascript">
	function user_trace_click_knowledge_in_project_detail_after_click_more(type,memo_id,session_id,page,rank,sort){
		//获取帖子所属项目
		url = document.URL;
		osp_id = url.substring(47);
		if(page == null){
			page = "nil"
		}
    	$.ajax({
			contentType: "application/json; charset=utf-8",
			timeout: 5000,
			url: '/user_traces/click_knowledge_in_project_detail_after_click_more?page=' + page + "&rank=" + rank + "&memo_id=" + memo_id + "&osp_id=" + osp_id + "&memo_type=" + type + "&session_id=" + session_id + "&sort=" + sort,
			dataType: "json"
		});
	}
</script>
<!-- ajax user trace zhangxunhui end -->